/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.view.main.header;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.jfonia.constants.ViewConstants;

/**
 *
 * @author Rik Bauwens
 */
public abstract class NotationPanel extends JPanel
{
        public NotationPanel(String title)
        {
                super();
                setOpaque(false);
                setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
                add(Box.createRigidArea(new Dimension(ViewConstants.LEFT_SPACING, 0)));
                addTitleLabel(new JLabel(title));
                init();
                add(Box.createHorizontalGlue());
                add(Box.createVerticalStrut(ViewConstants.BAR_HEIGHT));
        }

        protected void addTitleLabel(JLabel label)
        {
                label.setFont(label.getFont().deriveFont(Font.BOLD, ViewConstants.TITLE_LABEL_FONT_SIZE));
                add(label);
                add(Box.createRigidArea(new Dimension(ViewConstants.OPTIONS_SPACING, 0)));
        }

        protected void addLabel(JLabel label)
        {
                label.setFont(label.getFont().deriveFont(Font.BOLD, ViewConstants.OPTION_LABEL_FONT_SIZE));
                add(label);
                add(Box.createRigidArea(new Dimension(ViewConstants.LABEL_SPACING, 0)));
        }

        protected void addOption(Component component)
        {
                add(component);
                add(Box.createHorizontalStrut(ViewConstants.OPTION_SPACING));
        }

        protected void addSmallSpacing()
        {
                add(Box.createRigidArea(new Dimension(ViewConstants.LABEL_SPACING, 0)));
        }

        protected void addSpacing()
        {
                add(Box.createRigidArea(new Dimension(ViewConstants.OPTIONS_SPACING, 0)));
        }

        protected abstract void init();
}
